package com.spark.lola.entity.pur;

import java.math.BigDecimal;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.spark.lola.support.mybatis.entity.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 
 * </p>
 *
 * @author dengyejun
 * @since 2020-04-24
 */
@TableName("pur_order_product")
@ApiModel(value="OrderProduct对象", description="")
public class OrderProduct extends BaseModel implements Serializable {
    private static final long serialVersionUID=1L;
    public OrderProduct(){}
    @ApiModelProperty(value = "订单id 选填")
    private Long parentId;

    @ApiModelProperty(value = "货品ID")
    private Long productId;

    @ApiModelProperty(value = "货号")
    private String productNo;

    @ApiModelProperty(value = "货品名称")
    private String name;

    @ApiModelProperty(value = "扣点比例")
    private BigDecimal deduct = BigDecimal.ZERO;

    @ApiModelProperty(value = "采购数量(顿)")
    private BigDecimal quantity=BigDecimal.ZERO;

    @ApiModelProperty(value = "结算量(吨) 收货必填")
    private BigDecimal settleQuantity = BigDecimal.ZERO;

    @ApiModelProperty(value = "扣点(吨) 选填")
    @TableField(exist = false)
    private BigDecimal deductQuantity = BigDecimal.ZERO;

    @ApiModelProperty(value = "供货单价 定价必填")
    private BigDecimal price=BigDecimal.ZERO;

    @ApiModelProperty(value = "采购小计 选填")
    private BigDecimal money=BigDecimal.ZERO;

    @ApiModelProperty(value = "结算小计 选填")
    private BigDecimal settleMoney =BigDecimal.ZERO;

    @ApiModelProperty(value = "打包数")
    private Integer packages=0;

    @ApiModelProperty(value = "定价时间 选填")
    private Date pricingTime;

    public Date getPricingTime() {
        return pricingTime;
    }

    public void setPricingTime(Date pricingTime) {
        this.pricingTime = pricingTime;
    }

    public Integer getPackages() {
        return packages;
    }

    public void setPackages(Integer packages) {
        this.packages = packages;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }
    
    public String getProductNo() {
        return productNo;
    }

    public void setProductNo(String productNo) {
        this.productNo = productNo;
    }
    
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public BigDecimal getDeduct() {
        return deduct;
    }

    public void setDeduct(BigDecimal deduct) {
        this.deduct = deduct;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }
    
    public BigDecimal getMoney() {
        return money;
    }

    public void setMoney(BigDecimal money) {
        this.money = money;
    }

    public BigDecimal getQuantity() {
        return quantity;
    }

    public void setQuantity(BigDecimal quantity) {
        this.quantity = quantity;
    }

    public BigDecimal getSettleQuantity() {
        return settleQuantity;
    }

    public void setSettleQuantity(BigDecimal settleQuantity) {
        this.settleQuantity = settleQuantity;
    }

    public void setDeductQuantity(BigDecimal deductQuantity) {
        this.deductQuantity = deductQuantity;
    }

    public BigDecimal getSettleMoney() {
        return settleMoney;
    }

    public void setSettleMoney(BigDecimal settleMoney) {
        this.settleMoney = settleMoney;
    }


    public BigDecimal getDeductQuantity() {
        this.deductQuantity = this.quantity.multiply(this.deduct)
                .divide(new BigDecimal(100), 3, BigDecimal.ROUND_HALF_UP);
        return deductQuantity;
    }
}
